package com.alex.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.TimeUnit;

/**
 * 用户controller
 *
 * @author alex.shu
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @GetMapping(value = "/name")
    public String getUserName() {
        try {
            TimeUnit.SECONDS.sleep(5);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return "Alex.shu";
    }

    @GetMapping(value = "/list")
    public List<String> getUserNameGroup() {
        return Arrays.asList("Alex", "Peter", "Kit", "Bobby");
    }
}
